#include "composite.h"

void File::showName(int level)
{
    for(int i =0;i<level;i++)
    {
        std::cout <<" ";
    }
    std::cout << "-"<< m_name << std::endl;
}

void Dir::showName(int level)
{
    for(int i =0;i<level;i++)
    {
        std::cout <<" ";
    }
    std::cout << "+"<< m_name << std::endl;
    level++;
    for(auto it = m_fileList.begin();it!=m_fileList.end();it++)
    {
        (*it)->showName(level);
    }
}

void Dir::Add(std::shared_ptr<FileSystem> component)
{
    m_fileList.emplace_back(std::shared_ptr<FileSystem>(component));
}

void Dir::Remove(std::shared_ptr<FileSystem> component)
{
    m_fileList.remove(std::shared_ptr<FileSystem>(component));
}
